package utils;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;


public class TestJDBC {
	public static void main(String[] args) {
		Connection conn = Utils.getConnection();
		try {
			Statement stmt = conn.createStatement();
			String sql = "select * from hw_user";
			ResultSet rs = stmt.executeQuery(sql);
			while(rs.next()){//将光标向下移动一行，并判断下一行是否存在
				String id = rs.getString("id");
				String name = rs.getString("name");
				String sex = rs.getString("sex");
				System.out.println(id+","+name+","+sex);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}
